package com.jiang.www.servletRedirect;

import javax.servlet.*;
import javax.servlet.http.*;
import javax.servlet.annotation.*;
import java.io.IOException;

@WebServlet(name = "ServletRedirect", value = "/ServletRedirect")
public class ServletRedirect extends HttpServlet {
    @Override
    protected void doGet(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {
        this.doPost(request,response);
    }

    @Override
    protected void doPost(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {
//        response.setStatus(302);
//        response.setHeader("location","DServlet");
        //专门封装了上面两个 方便调用
        System.out.println("请求发送给ds");
        response.sendRedirect("DServlet");
        String name;
    }
}
